<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of validate
 * validation jobs
 *
 * @author Bumoni
 * Revision history
 */

class validate extends dbtransction
{   
    /* this method will validate email*/ 
    function validate_email()
    {
       if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $this->email)) 
       {
            $this->email=  addslashes($this->email);
            $email_check=  database::get_record("select email from user where email='$this->email'");
            if($email_check)
            {
                $this->st=2;
            }
            else
            {
                $this->st=1;
            }
       }
       else
       {
            $this->st=2;
       }
       
       return $this->st;
    } 
    
    /* this method will validate link*/
    function validate_pwd()
    {
        if($this->pwd=='')
        {
            return 2;
        }
        else
        {
            return 1;
        }
    }
    
    /* this method will validate link*/
    function validate_link()
    {
       if($this->link=='')
        {
            return 2;
        }
        else
        {
            $link_check=database::get_record("select link from user where link='$this->link'");
            if($link_check)
            {
                return 2;
            }
            else
            {
                return 1;
            } 
               
        }
    }
    
    /* this method will validate if field is blank or not*/
    function validate_gen()
    {
        if($this->fname=='')
        {
            return 2;
        }
        else
        {
            return 1;
        }
    }
}

?>
